<?php

namespace app\api\controller;
use app\common\business\Category as CategoryBis;

class Category extends ApiBase
{
    public function index()
    {
        try {
            $categoryBusObj =  new CategoryBis();
            $categorys = $categoryBusObj->getNormalCategorys();
        }catch (\Exception $e){
            return show(config("status.success"),"内部异常");
        }

        if(empty($categorys)){
            return show(config("status.success"),"数据为空");
        }

        $result = \app\common\lib\Arr::getTree($categorys);
        $result = \app\common\lib\Arr::sliceTreeArr($result);
        return show(config("status.success"),"ok",$result);
    }
}